home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / WASTE 1.2a4 / WASTE Pascal Interfaces / WASTE.p < prev   
Encoding:
Text File  |  1995-12-10  |  22.1 KB  |  725 lines  |  [TEXT/CWIE]

  1. unit WASTE;
  2.  
  3. { Pascal interface to the WASTE text engine }
  4.  
  5. { version 1.2a4 (December 1995) }
  6.  
  7. { Copyright © 1993-1995 Marco Piovanelli }
  8. { All Rights Reserved }
  9.  
  10. interface
  11.     uses
  12.         ConditionalMacros,
  13.         Types,
  14.         MixedMode,
  15.         QuickdrawText,
  16.         Quickdraw,
  17.         Script,
  18.         TextUtils,
  19.         TextEdit,
  20.         Drag,
  21.         LongCoords;
  22.  
  23. {$PUSH}
  24. {$ALIGN MAC68K}
  25.  
  26.     const
  27.  
  28. { result codes }
  29.  
  30.         weCantUndoErr = -10015;                    { undo buffer is clear (= errAECantUndo) }
  31.         weEmptySelectionErr = -10013;            { empty selection range (= errAENoUserSelection) }
  32.         weNotHandledErr = -1708;                    { please use default behavior (= errAEEventNotHandled) }
  33.         weUnknownObjectTypeErr = -9478;        { specified object type is not registered }
  34.         weObjectNotFoundErr = -9477;                { no object found at specified offset }
  35.         weReadOnlyErr = -9476;                        { cannot modify instance }
  36.         weUndefinedSelectorErr = -50;                { unknown selector (= paramErr) }
  37.  
  38. { alignment styles }
  39.  
  40.         weFlushLeft = -2;                        { flush left }
  41.         weFlushRight = -1;                    { flush right }
  42.         weFlushDefault = 0;                    { flush according to system direction }
  43.         weCenter = 1;                            { centered }
  44.         weJustify = 2;                            { fully justified }
  45.  
  46. { values for the mode parameter in WESetStyle and WEContinuousStyle }
  47.  
  48.         weDoFont                         = $0001;    { set font family number }
  49.         weDoFace                         = $0002;    { set Quickdraw styles }
  50.         weDoSize                             = $0004;    { set type size }
  51.         weDoColor                         = $0008;    { set color }
  52.         weDoAll                             = weDoFont + weDoFace + weDoSize + weDoColor;
  53.         weDoAddSize                     = $0010;    { adjust type size }
  54.         weDoToggleFace                 = $0020;    { turn a style off if it's continuous over the selection }
  55.         weDoReplaceFace                 = $0040;    { replace existing styles outright }
  56.         weDoPreserveScript            = $0080;    { don't change scripts when applying a font change }
  57.         weDoExtractSubscript         = $0100;    { extract subscripts when applying a font change }
  58.         weDoFaceMask                 = $0200;    { set Quickdraw styles using mask field }
  59.  
  60. { values for the edge parameter in WEGetOffset etc. }
  61.  
  62.         kLeadingEdge = -1;                    { point is on the leading edge of a glyph }
  63.         kTrailingEdge = 0;                        { point is on the trailing edge of a glyph }
  64.         kObjectEdge = 2;                        { point is in the middle of an embedded object }
  65.  
  66. { values for WEFeatureFlag feature parameter }
  67.  
  68.         weFAutoScroll                 = 0;            { automatically scroll the selection range into view }
  69.         weFOutlineHilite             = 2;            { frame selection when deactivated }
  70.         weFReadOnly                 = 5;            { disallow modifications }
  71.         weFUndo                         = 6;            { support WEUndo }
  72.         weFIntCutAndPaste         = 7;            { use intelligent cut-and-paste rules }
  73.         weFDragAndDrop         = 8;            { support drag-and-drop text editing }
  74.         weFInhibitRecal             = 9;            { don't recalculate line starts and don't redraw text }
  75.         weFUseTempMem         = 10;            { use temporary memory for main data structures }
  76.         weFDrawOffscreen         = 11;            { draw text offscreen for smoother visual results }
  77.         weFInhibitRedraw         = 12;            { don't redraw text }
  78.         weFMonoStyled            = 13;            { disallow style changes }
  79.         weFInhibitColor             = 31;            { draw in black & white only }
  80.  
  81. { values for WENew flags parameter }
  82.  
  83.         weDoAutoScroll                 = $00000001;
  84.         weDoOutlineHilite             = $00000004;
  85.         weDoReadOnly                     = $00000020;
  86.         weDoUndo                         = $00000040;
  87.         weDoIntCutAndPaste         = $00000080;
  88.         weDoDragAndDrop             = $00000100;
  89.         weDoInhibitRecal             = $00000200;
  90.         weDoUseTempMem             = $00000400;
  91.         weDoDrawOffscreen             = $00000800;
  92.         weDoInhibitRedraw            = $00001000;
  93.         weDoMonoStyled                = $00002000;
  94.         weDoInhibitColor                = $80000000;
  95.  
  96. { values for WEFeatureFlag action parameter }
  97.  
  98.         weBitToggle = -2;                        { toggles the specified feature }
  99.         weBitTest = -1;                            { returns the current setting of the specified feature }
  100.         weBitClear = 0;                            { disables the specified feature }
  101.         weBitSet = 1;                            { enables the specified feature }
  102.  
  103. { values for WEGetInfo and WESetInfo selector parameter }
  104.  
  105.         weCharToPixelHook = 'c2p ';        { CharToPixel hook }
  106.         weClickLoop = 'clik';                    { click loop callback }
  107.         weCurrentDrag = 'drag';            { drag currently being tracked from WEClick }
  108.         weDrawTextHook = 'draw';        { text drawing hook }
  109.         weLineBreakHook = 'lbrk';        { line breaking hook }
  110.         wePixelToCharHook = 'p2c ';        { PixelToChar hook }
  111.         wePort = 'port';                            { graphics port }
  112.         weRefCon = 'refc';                        { reference constant for use by application }
  113.         weScrollProc = 'scrl';                    { scroll callback }
  114.         weText = 'text';                            { handle to the raw text }
  115.         weTranslateDragHook = 'xdrg';    { drag translation callback }
  116.         weTSMDocumentID = 'tsmd';        { Text Services Manager document ID }
  117.         weTSMPreUpdate = 'pre ';            { Text Services Manager pre-update callback }
  118.         weTSMPostUpdate = 'post';        { Text Services Manager post-update callback }
  119.         weURLHint = 'urlh';                    { URL hint string for Internet Config }
  120.  
  121. { values for WEInstallObjectHandler handlerSelector parameter }
  122.  
  123.         weNewHandler = 'new ';            { new handler }
  124.         weDisposeHandler = 'free';        { dispose handler }
  125.         weDrawHandler = 'draw';            { draw handler }
  126.         weClickHandler = 'clik';                { click handler }
  127.         weStreamHandler = 'strm';        { stream handler }
  128.  
  129. { action kinds }
  130.  
  131.         weAKNone                 = 0;                { null action }
  132.         weAKUnspecified     = 1;                { action of unspecified nature }
  133.         weAKTyping             = 2;                { some text has been typed in }
  134.         weAKCut                     = 3;                { the selection range has been cut }
  135.         weAKPaste                 = 4;                { something has been pasted }
  136.         weAKClear                 = 5;                { the selection range has been deleted }
  137.         weAKDrag                 = 6;                { drag and drop operation }
  138.         weAKSetStyle             = 7;                { some style has been applied to a text range }
  139.  
  140. { destination kinds for stream handler }
  141.  
  142.         weToScrap        =    0;
  143.         weToDrag            =    1;
  144.         weToSoup            =    2;
  145.  
  146.     type
  147.  
  148. { if we're using a pre-2.1 version of the Universal Headers, define EventModifiers }
  149. {$IFC UNDEFINED UNIVERSAL_INTERFACES_VERSION}
  150.     type
  151.         EventModifiers = Integer;
  152. {$ENDC}
  153.  
  154. { WASTE data types }
  155.  
  156.         WEReference = Ptr;
  157.         WEObjectReference = Ptr;
  158.         WESoupHandle = Handle;
  159.         WEActionKind = Integer;
  160.         WEAlignment = SignedByte;
  161.         WEStyleMode = Integer;
  162.         WESelector = FourCharCode;
  163.         WEHandle = WEReference;        { obsolete; kept for backward compatibility }
  164.  
  165.         WERunInfo = record
  166.                 runStart: LongInt;                            { byte offset to first character of style run }
  167.                 runEnd: LongInt;                            { byte offset past last character of style run }
  168.                 runHeight: Integer;                        { line height (ascent + descent + leading) }
  169.                 runAscent: Integer;                        { font ascent }
  170.                 runStyle: TextStyle;                        { text attributes }
  171.                 runObject: WEObjectReference;        { either NIL or reference to embedded object }
  172.             end;  { WERunInfo }
  173.  
  174. { callback prototypes }
  175.  
  176. { FUNCTION MyClickLoop(we: WEReference): Boolean; }
  177.         WEClickLoopProcPtr = ProcPtr;
  178.         WEClickLoopUPP = UniversalProcPtr;
  179.  
  180. { PROCEDURE MyScrollProc(we: WEReference); }
  181.         WEScrollProcPtr = ProcPtr;
  182.         WEScrollUPP = UniversalProcPtr;
  183.  
  184. { PROCEDURE MyTSMPreUpdate(we: WEReference); }
  185.         WETSMPreUpdateProcPtr = ProcPtr;
  186.         WETSMPreUpdateUPP = UniversalProcPtr;
  187.  
  188. { PROCEDURE MyTSMPostUpdate(we: WEReference; fixLength: LongInt; }
  189. {         inputAreaStart, inputAreaEnd:LongInt; }
  190. {        pinRangeStart, pinRangeEnd: LongInt); }
  191.         WETSMPostUpdateProcPtr = ProcPtr;
  192.         WETSMPostUpdateUPP = UniversalProcPtr;
  193.  
  194. { FUNCTION MyTranslateDrag (theDrag: DragReference; theItem: ItemReference; }
  195. {         requestedType: FlavorType; putDataHere: Handle): OSErr; }
  196.         WETranslateDragProcPtr = ProcPtr;
  197.         WETranslateDragUPP = UniversalProcPtr;
  198.  
  199. { PROCEDURE MyDrawText (pText: Ptr; textLength: LongInt; slop: Fixed; }
  200. {         styleRunPosition: JustStyleCode; we: WEReference); }
  201.         WEDrawTextProcPtr = ProcPtr;
  202.         WEDrawTextUPP = UniversalProcPtr;
  203.  
  204. { FUNCTION MyPixelToChar (pText: Ptr; textLength: LongInt; slop: Fixed; }
  205. {         var pixelWidth: Fixed; var edge: SignedByte; }
  206. {         styleRunPosition: JustStyleCode; hPos: Fixed; we: WEReference): LongInt; }
  207.         WEPixelToCharProcPtr = ProcPtr;
  208.         WEPixelToCharUPP = UniversalProcPtr;
  209.  
  210. { FUNCTION MyCharToPixel (pText: Ptr; textLength: LongInt; slop: Fixed; }
  211. {        offset: LongInt; direction: Integer; }
  212. {        styleRunPosition: JustStyleCode; hPos: LongInt; we:WEReference): Integer; }
  213.         WECharToPixelProcPtr = ProcPtr;
  214.         WECharToPixelUPP = UniversalProcPtr;
  215.  
  216. { FUNCTION MyLineBreak (pText: Ptr; textLength: LongInt; }
  217. {        textStart, textEnd: LongInt; var textWidth: Fixed; var textOffset: LongInt; }
  218. {        we: WEReference): StyledLineBreakCode; }
  219.         WELineBreakProcPtr = ProcPtr;
  220.         WELineBreakUPP = UniversalProcPtr;
  221.  
  222. { FUNCTION MyNewObject(var defaultObjectSize: Point; }
  223. {                    objectRef: WEObjectReference): OSErr; }
  224.         WENewObjectProcPtr = ProcPtr;
  225.         WENewObjectUPP = UniversalProcPtr;
  226.  
  227. { FUNCTION MyDisposeObject (objectRef: WEObjectReference): OSErr; }
  228.         WEDisposeObjectProcPtr = ProcPtr;
  229.         WEDisposeObjectUPP = UniversalProcPtr;
  230.  
  231. { FUNCTION MyDrawObject (var destRect: Rect; }
  232. {         objectRef: WEObjectReference): OSErr }
  233.         WEDrawObjectProcPtr = ProcPtr;
  234.         WEDrawObjectUPP = UniversalProcPtr;
  235.  
  236. { FUNCTION MyClickObject (hitPt: Point; modifiers: EventModifiers; clickTime: LongInt; }
  237. {         objectRef: WEObjectReference): Boolean; }
  238.         WEClickObjectProcPtr = ProcPtr;
  239.         WEClickObjectUPP = UniversalProcPtr;
  240.  
  241. { FUNCTION MyStreamObject (destKind: Integer; var theType: FlavorType; }
  242. {        putDataHere: Handle; objectRef: WEObjectReference): OSErr; }
  243.         WEStreamObjectProcPtr = ProcPtr;
  244.         WEStreamObjectUPP = UniversalProcPtr;
  245.  
  246.     const
  247.  
  248. { UPP proc info }
  249.  
  250.         uppWEClickLoopProcInfo = $000000D0;
  251.         uppWEScrollProcInfo = $000000C0;
  252.         uppWETSMPreUpdateProcInfo = $000000C0;
  253.         uppWETSMPostUpdateProcInfo = $0003FFC0;
  254.         uppWETranslateDragProcInfo = $00003FE0;
  255.         uppWEDrawTextProcInfo = $0000EFC0;
  256.         uppWEPixelToCharProcInfo = $003EFFF0;
  257.         uppWECharToPixelProcInfo = $003EBFE0;
  258.         uppWELineBreakProcInfo = $000FFFD0;
  259.         uppWENewObjectProcInfo = $000003E0;
  260.         uppWEDisposeObjectProcInfo = $000000E0;
  261.         uppWEDrawObjectProcInfo = $000003E0;
  262.         uppWEClickObjectProcInfo = $00003ED0;
  263.         uppWESteamObjectProcInfo = $00003FA0;
  264.  
  265. { NewProc macros }
  266.  
  267.     function NewWEClickLoopProc (userRoutine: WEClickLoopProcPtr): WEClickLoopUPP;
  268. {$IFC NOT GENERATINGCFM}
  269.     inline
  270.         $2E9F;
  271. {$ENDC}
  272.  
  273.     function NewWEScrollProc (userRoutine: WEScrollProcPtr): WEScrollUPP;
  274. {$IFC NOT GENERATINGCFM}
  275.     inline
  276.         $2E9F;
  277. {$ENDC}
  278.  
  279.     function NewWETSMPreUpdateProc (userRoutine: WETSMPreUpdateProcPtr): WETSMPreUpdateUPP;
  280. {$IFC NOT GENERATINGCFM}
  281.     inline
  282.         $2E9F;
  283. {$ENDC}
  284.  
  285.     function NewWETSMPostUpdateProc (userRoutine: WETSMPostUpdateProcPtr): WETSMPostUpdateUPP;
  286. {$IFC NOT GENERATINGCFM}
  287.     inline
  288.         $2E9F;
  289. {$ENDC}
  290.  
  291.     function NewWETranslateDragProc (userRoutine: WETranslateDragProcPtr): WETranslateDragUPP;
  292. {$IFC NOT GENERATINGCFM}
  293.     inline
  294.         $2E9F;
  295. {$ENDC}
  296.  
  297.     function NewWEDrawTextProc (userRoutine: WEDrawTextProcPtr): WEDrawTextUPP;
  298. {$IFC NOT GENERATINGCFM}
  299.     inline
  300.         $2E9F;
  301. {$ENDC}
  302.  
  303.     function NewWEPixelToCharProc (userRoutine: WEPixelToCharProcPtr): WEPixelToCharUPP;
  304. {$IFC NOT GENERATINGCFM}
  305.     inline
  306.         $2E9F;
  307. {$ENDC}
  308.  
  309.     function NewWECharToPixelProc (userRoutine: WECharToPixelProcPtr): WECharToPixelUPP;
  310. {$IFC NOT GENERATINGCFM}
  311.     inline
  312.         $2E9F;
  313. {$ENDC}
  314.  
  315.     function NewWELineBreakProc (userRoutine: WELineBreakProcPtr): WELineBreakUPP;
  316. {$IFC NOT GENERATINGCFM}
  317.     inline
  318.         $2E9F;
  319. {$ENDC}
  320.  
  321.     function NewWENewObjectProc (userRoutine: WENewObjectProcPtr): WENewObjectUPP;
  322. {$IFC NOT GENERATINGCFM}
  323.     inline
  324.         $2E9F;
  325. {$ENDC}
  326.  
  327.     function NewWEDisposeObjectProc (userRoutine: WEDisposeObjectProcPtr): WEDisposeObjectUPP;
  328. {$IFC NOT GENERATINGCFM}
  329.     inline
  330.         $2E9F;
  331. {$ENDC}
  332.  
  333.     function NewWEDrawObjectProc (userRoutine: WEDrawObjectProcPtr): WEDrawObjectUPP;
  334. {$IFC NOT GENERATINGCFM}
  335.     inline
  336.         $2E9F;
  337. {$ENDC}
  338.  
  339.     function NewWEClickObjectProc (userRoutine: WEClickObjectProcPtr): WEClickObjectUPP;
  340. {$IFC NOT GENERATINGCFM}
  341.     inline
  342.         $2E9F;
  343. {$ENDC}
  344.  
  345.     function NewWEStreamObjectProc (userRoutine: WEStreamObjectProcPtr): WEStreamObjectUPP;
  346. {$IFC NOT GENERATINGCFM}
  347.     inline
  348.         $2E9F;
  349. {$ENDC}
  350.  
  351. { CallProc macros }
  352.  
  353.     function CallWEClickLoopProc (we: WEReference;
  354.                                     userRoutine: WEClickLoopUPP): Boolean;
  355. {$IFC NOT GENERATINGCFM}
  356.     inline
  357.         $205F, $4E90;
  358. {$ENDC}
  359.  
  360.     procedure CallWEScrollProc (we: WEReference;
  361.                                     userRoutine: WEScrollUPP);
  362. {$IFC NOT GENERATINGCFM}
  363.     inline
  364.         $205F, $4E90;
  365. {$ENDC}
  366.  
  367.     procedure CallWETSMPreUpdateProc (we: WEReference;
  368.                                     userRoutine: WETSMPreUpdateUPP);
  369. {$IFC NOT GENERATINGCFM}
  370.     inline
  371.         $205F, $4E90;
  372. {$ENDC}
  373.  
  374.     procedure CallWETSMPostUpdateProc (we: WEReference;
  375.                                     fixLength: LongInt;
  376.                                     inputAreaStart, inputAreaEnd: LongInt;
  377.                                     pinRangeStart, pinRangeEnd: LongInt;
  378.                                     userRoutine: WETSMPostUpdateUPP);
  379. {$IFC NOT GENERATINGCFM}
  380.     inline
  381.         $205F, $4E90;
  382. {$ENDC}
  383.  
  384.     function CallTranslateDrag (theDrag: DragReference;
  385.                                     theItem: ItemReference;
  386.                                     requestedType: FlavorType;
  387.                                     putDataHere: Handle;
  388.                                     userRoutine: WETranslateDragUPP): OSErr;
  389. {$IFC NOT GENERATINGCFM}
  390.     inline
  391.         $205F, $4E90;
  392. {$ENDC}
  393.  
  394.     procedure CallWEDrawTextProc (pText: Ptr;
  395.                                     textLength: LongInt;
  396.                                     slop: Fixed;
  397.                                     styleRunPosition: JustStyleCode;
  398.                                     we: WEReference;
  399.                                     userRoutine: WEDrawTextUPP);
  400. {$IFC NOT GENERATINGCFM}
  401.     inline
  402.         $205F, $4E90;
  403. {$ENDC}
  404.  
  405.     function CallWEPixelToCharProc (pText: Ptr;
  406.                                     textLength: LongInt;
  407.                                     slop: Fixed;
  408.                                     var width: Fixed;
  409.                                     var edge: SignedByte;
  410.                                     styleRunPosition: JustStyleCode;
  411.                                     hPos: Fixed;
  412.                                     we: WEReference;
  413.                                     userRoutine: WEPixelToCharUPP): LongInt;
  414. {$IFC NOT GENERATINGCFM}
  415.     inline
  416.         $205F, $4E90;
  417. {$ENDC}
  418.  
  419.     function CallWECharToPixelProc (pText: Ptr;
  420.                                     textLength: LongInt;
  421.                                     slop: Fixed;
  422.                                     offset: LongInt;
  423.                                     direction: Integer;
  424.                                     styleRunPosition: JustStyleCode;
  425.                                     hPos: LongInt;
  426.                                     we: WEReference;
  427.                                     userRoutine: WECharToPixelUPP): Integer;
  428. {$IFC NOT GENERATINGCFM}
  429.     inline
  430.         $205F, $4E90;
  431. {$ENDC}
  432.  
  433.     function CallWELineBreakProc (pText: Ptr;
  434.                                     textLength: LongInt;
  435.                                     textStart, textEnd: LongInt;
  436.                                     var textWidth: Fixed;
  437.                                     var textOffset: LongInt;
  438.                                     we: WEReference;
  439.                                     userRoutine: WELineBreakUPP): StyledLineBreakCode;
  440. {$IFC NOT GENERATINGCFM}
  441.     inline
  442.         $205F, $4E90;
  443. {$ENDC}
  444.  
  445.     function CallWENewObjectProc (var defaultObjectSize: Point;
  446.                                     objectRef: WEObjectReference;
  447.                                     userRoutine: WENewObjectUPP): OSErr;
  448. {$IFC NOT GENERATINGCFM}
  449.     inline
  450.         $205F, $4E90;
  451. {$ENDC}
  452.  
  453.     function CallWEDisposeObjectProc (objectRef: WEObjectReference;
  454.                                     userRoutine: WEDisposeObjectUPP): OSErr;
  455. {$IFC NOT GENERATINGCFM}
  456.     inline
  457.         $205F, $4E90;
  458. {$ENDC}
  459.  
  460.     function CallWEDrawObjectProc ({const} var destRect: Rect;
  461.                                     objectRef: WEObjectReference;
  462.                                     userRoutine: WEDrawObjectUPP): OSErr;
  463. {$IFC NOT GENERATINGCFM}
  464.     inline
  465.         $205F, $4E90;
  466. {$ENDC}
  467.  
  468.     function CallWEClickObjectProc (hitPoint: Point;
  469.                                     modifiers: EventModifiers;
  470.                                     clickTime: LongInt;
  471.                                     objectRef: WEObjectReference;
  472.                                     userRoutine: WEClickObjectUPP): Boolean;
  473. {$IFC NOT GENERATINGCFM}
  474.     inline
  475.         $205F, $4E90;
  476. {$ENDC}
  477.  
  478.     function CallWEStreamObjectProc (destKind: Integer;
  479.                                     var theType: FlavorType;
  480.                                     putDataHere: Handle;
  481.                                     objectRef: WEObjectReference;
  482.                                     userRoutine: WEStreamObjectUPP): OSErr;
  483. {$IFC NOT GENERATINGCFM}
  484.     inline
  485.         $205F, $4E90;
  486. {$ENDC}
  487.  
  488.  
  489. { WASTE PUBLIC CALLS }
  490.  
  491. { creation and destruction }
  492.  
  493.     function WENew ({const} var destRect, viewRect: LongRect;
  494.                                     flags: LongInt;
  495.                                     var we: WEReference): OSErr;
  496.     procedure WEDispose (we: WEReference);
  497.  
  498. { getting variables }
  499.  
  500.     function WEGetText (we: WEReference): Handle;
  501.     function WEGetChar (offset: LongInt;
  502.                                     we: WEReference): Char;
  503.     function WEGetTextLength (we: WEReference): LongInt;
  504.     function WECountLines (we: WEReference): LongInt;
  505.     function WEGetHeight (startLine, endLine: LongInt;
  506.                                     we: WEReference): LongInt;
  507.     procedure WEGetSelection (var selStart, selEnd: LongInt;
  508.                                     we: WEReference);
  509.     procedure WEGetDestRect (var destRect: LongRect;
  510.                                     we: WEReference);
  511.     procedure WEGetViewRect (var viewRect: LongRect;
  512.                                     we: WEReference);
  513.     function WEIsActive (we: WEReference): Boolean;
  514.     function WEOffsetToLine (offset: LongInt;
  515.                                     we: WEReference): LongInt;
  516.     procedure WEGetLineRange (lineNo: LongInt;
  517.                                     var lineStart, lineEnd: LongInt;
  518.                                     we: WEReference);
  519.  
  520. { setting variables }
  521.  
  522.     procedure WESetSelection (selStart, selEnd: LongInt;
  523.                                     we: WEReference);
  524.     procedure WESetDestRect ({const} var destRect: LongRect;
  525.                                     we: WEReference);
  526.     procedure WESetViewRect ({const} var viewRect: LongRect;
  527.                                     we: WEReference);
  528.  
  529. { accessing style run information }
  530.  
  531.     function WEContinuousStyle (var mode: WEStyleMode;
  532.                                     var ts: TextStyle;
  533.                                     we: WEReference): Boolean;
  534.     procedure WEGetRunInfo (offset: LongInt;
  535.                                     var info: WERunInfo;
  536.                                     we: WEReference);
  537.  
  538. { converting byte offsets to screen positions and vice versa }
  539.     function WEGetOffset ({const} var thePoint: LongPt;
  540.                                     var edge: SignedByte;
  541.                                     we: WEReference): LongInt;
  542.     procedure WEGetPoint (offset: LongInt;
  543.                                     var thePoint: LongPt;
  544.                                     var lineHeight: Integer;
  545.                                     we: WEReference);
  546.  
  547. { finding words and lines }
  548.     procedure WEFindWord (offset: LongInt;
  549.                                     edge: SignedByte;
  550.                                     var wordStart, wordEnd: LongInt;
  551.                                     we: WEReference);
  552.     procedure WEFindLine (offset: LongInt;
  553.                                     edge: SignedByte;
  554.                                     var lineStart, lineEnd: LongInt;
  555.                                     we: WEReference);
  556.  
  557. { making a copy of a text range }
  558.  
  559.     function WECopyRange (rangeStart, rangeEnd: LongInt;
  560.                                     hText: Handle;
  561.                                     hStyles: StScrpHandle;
  562.                                     hSoup: WESoupHandle;
  563.                                     we: WEReference): OSErr;
  564.  
  565. { getting and setting the alignment style }
  566.  
  567.     function WEGetAlignment (we: WEReference): WEAlignment;
  568.     procedure WESetAlignment (alignment: WEAlignment;
  569.                                     we: WEReference);
  570.  
  571. { recalculating line breaks, drawing and scrolling }
  572.  
  573.     function WECalText (we: WEReference): OSErr;
  574.     procedure WEUpdate (updateRgn: RgnHandle;
  575.                                     we: WEReference);
  576.     procedure WEScroll (hOffset, vOffset: LongInt;
  577.                                     we: WEReference);
  578.     procedure WESelView (we: WEReference);
  579.  
  580. { handling activate/deactivate events }
  581.  
  582.     procedure WEActivate (we: WEReference);
  583.     procedure WEDeactivate (we: WEReference);
  584.  
  585. { handling key-down events }
  586.  
  587.     procedure WEKey (key: Char;
  588.                                     modifiers: EventModifiers;
  589.                                     we: WEReference);
  590.  
  591. { handling mouse-down events and mouse tracking }
  592.  
  593.     procedure WEClick (hitPt: Point;
  594.                                     modifiers: EventModifiers;
  595.                                     clickTime: LongInt;
  596.                                     we: WEReference);
  597.  
  598. { adjusting the cursor shape }
  599.  
  600.     function WEAdjustCursor (mouseLoc: Point;
  601.                                     mouseRgn: RgnHandle;
  602.                                     we: WEReference): Boolean;
  603.  
  604. { blinking the caret }
  605.  
  606.     procedure WEIdle (var maxSleep: LongInt;
  607.                                     we: WEReference);
  608.  
  609. { modifying the text and the styles }
  610.  
  611.     function WEInsert (pText: Ptr;
  612.                                     textLength: LongInt;
  613.                                     hStyles: StScrpHandle;
  614.                                     hSoup: WESoupHandle;
  615.                                     we: WEReference): OSErr;
  616.     function WEDelete (we: WEReference): OSErr;
  617.     function WESetStyle (mode: WEStyleMode;
  618.                                     {const} var ts: TextStyle;
  619.                                     we: WEReference): OSErr;
  620.     function WEUseText (hText: Handle;
  621.                                     we: WEReference): OSErr;
  622.     function WEUseStyleScrap (hStyles: StScrpHandle;
  623.                                     we: WEReference): OSErr;
  624.  
  625. { undo }
  626.  
  627.     function WEUndo (we: WEReference): OSErr;
  628.     procedure WEClearUndo (we: WEReference);
  629.     function WEGetUndoInfo (var redoFlag: Boolean;
  630.                                     we: WEReference): WEActionKind;
  631.     function WEIsTyping (we: WEReference): Boolean;
  632.  
  633. { keeping track of changes }
  634.  
  635.     function WEGetModCount (we: WEReference): LongInt;
  636.     procedure WEResetModCount (we: WEReference);
  637.  
  638. { embedded objects }
  639.  
  640.     function WEInstallObjectHandler (objectType: FlavorType;
  641.                                     handlerSelector: WESelector;
  642.                                     handler: ProcPtr;
  643.                                     we: WEReference): OSErr;
  644.     function WEInsertObject (objectType: FlavorType;
  645.                                     objectDataHandle: Handle;
  646.                                     objectSize: Point;        { (0, 0) means default size }
  647.                                     we: WEReference): OSErr;
  648.     function WEGetSelectedObject (var objectRef: WEObjectReference;
  649.                                     we: WEReference): OSErr;
  650.     function WEFindNextObject (offset: LongInt;
  651.                                     var objectRef: WEObjectReference;
  652.                                     we: WEReference): LongInt;
  653.     function WEUseSoup (hSoup: WESoupHandle;
  654.                                     we: WEReference): LongInt;
  655.  
  656. { accessing embedded object attributes }
  657.     function WEGetObjectType (objectRef: WEObjectReference): FlavorType;
  658.     function WEGetObjectDataHandle (objectRef: WEObjectReference): Handle;
  659.     function WEGetObjectSize (objectRef: WEObjectReference): Point;
  660.     function WEGetObjectOwner (objectRef: WEObjectReference): WEReference;
  661.     function WEGetObjectRefCon (objectRef: WEObjectReference): LongInt;
  662.     procedure WESetObjectRefCon (objectRef: WEObjectReference;
  663.                                     refCon: LongInt);
  664.  
  665. { Clipboard operations }
  666.     function WECut (we: WEReference): OSErr;
  667.     function WECopy (we: WEReference): OSErr;
  668.     function WEPaste (we: WEReference): OSErr;
  669.     function WECanPaste (we: WEReference): Boolean;
  670.  
  671. { Drag Manager support }
  672.     function WEGetHiliteRgn (rangeStart, rangeEnd: LongInt;
  673.                                     we: WEReference): RgnHandle;
  674.     function WETrackDrag (message: DragTrackingMessage;
  675.                                     drag: DragReference;
  676.                                     we: WEReference): OSErr;
  677.     function WEReceiveDrag (drag: DragReference;
  678.                                     we: WEReference): OSErr;
  679.     function WECanAcceptDrag (drag: DragReference;
  680.                                     we: WEReference): Boolean;
  681.     function WEDraggedToTrash (drag: DragReference): Boolean;
  682.  
  683. { Script Manager utilities }
  684.     function WECharByte (offset: LongInt;
  685.                                     we: WEReference): Integer;
  686.     function WECharType (offset: LongInt;
  687.                                     we: WEReference): Integer;
  688.  
  689. { Text Services Manager support }
  690.     function WEInstallTSMHandlers: OSErr;
  691.     function WERemoveTSMHandlers: OSErr;
  692.     procedure WEStopInlineSession (we: WEReference);
  693.  
  694. { additional features }
  695.     function WEFeatureFlag (feature: Integer;
  696.                                     action: Integer;
  697.                                     we: WEReference): Integer;
  698.     function WEGetInfo (selector: WESelector;
  699.                                     info: univ Ptr;
  700.                                     we: WEReference): OSErr;
  701.     function WESetInfo (selector: WESelector;
  702.                                     info: univ Ptr;
  703.                                     we: WEReference): OSErr;
  704.  
  705. { long coordinates utility routines }
  706.     procedure WELongPointToPoint ({const} var lp: LongPt;
  707.                                     var p: Point);
  708.     procedure WEPointToLongPoint (p: Point;
  709.                                     var lp: LongPt);
  710.     procedure WESetLongRect (var lr: LongRect;
  711.                                     left, top, right, bottom: LongInt);
  712.     procedure WELongRectToRect ({const} var lr: LongRect;
  713.                                     var r: Rect);
  714.     procedure WERectToLongRect ({const} var r: Rect;
  715.                                     var lr: LongRect);
  716.     procedure WEOffsetLongRect (var lr: LongRect;
  717.                                     hOffset, vOffset: LongInt);
  718.     function WELongPointInLongRect ({const} var lp: LongPt;
  719.                                     {const} var lr: LongRect): Boolean;
  720.  
  721. {$ALIGN RESET}
  722. {$POP}
  723.  
  724. implementation
  725. end.